Component({
  /**
   * 组件的属性列表
   */
  properties: {},

  /**
   * 组件的初始数据
   */
  data: {
    selected: 0,
    color: "#ccc",
    selectedColor: "#ee864e",
    list: [{
        iconfont: 'icon-home',
        title: '首页',
        path: '/pages/index/index',
      },
      {
        iconfont: 'icon-fenlei',
        title: '分类',
        path: '/pages/type/type',
      },
      {
        iconfont: 'icon-gouwuche',
        title: '购物车',
        path: '/pages/shopp/shopp',
      },
      {
        iconfont: 'icon-gerenzhongxin',
        title: '我的',
        path: '/pages/person/person',
      }
    ],
  },

  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path;
      console.log("data", data)
      if (data.index == 2) {
        wx.navigateTo({
          url: '/pages/shopp/shopp',
        })
      } else {
        wx.switchTab({
          url
        })
      }
      this.setData({
        selected: data.index
      })
    }
  }
})